/*
*	冰火家族萬能NPC
*
*
*
*
*
*/
var x = "#fEffect/CharacterEff/1112949/0/0#";//高音譜記號
var kk = "#fEffect/BasicEff/MainNotice/Boss/Default/0#";//BOSS
var c = "#fEffect/CharacterEff/1032063/0/0#";//"#fUI/UIMiniGame/starPlanetRPS/heart#";//愛心
var cmark = "#fUI/UIPVP/ChampionMark/1#";//愛心
var lb = "#fEffect/ItemEff/1112811/0/0#";//藍色小光
var b = "#fEffect/CharacterEff/Shaman/1#";//超萌熊熊
var cat = "#fEffect/CharacterEff/Shaman/4#";//超萌喵咪
var leaf = "#fUI/Basic.img/Cursor/18/0#";
var status;
var sele1;

var menuList = Array(
        Array(lb, "星力系統", 0, true),
		Array(lb, "洗潛工具", 1, true),
		Array(lb, "星石強化", 2, true),
		Array(lb, "強化系統", 3, true),
		Array(lb, "潛能傳承", 4, true)
		);
function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {

    if (mode == 0) {
	cm.dispose();
	return;
    } else if (mode == 1){
	status++;
    } else {
	status--;
    }

    switch (status) {
        case 0: 
			text = "\t  "+c+"#fn华文行楷##fs30##e#k #b裝備強化 " +c+ "\r\n#fs12##fn宋体#";
			
			var ccc = 0;
			for (var i = 0; i < menuList.length; i++) {
				if(ccc%3 == 0)
					text +="\r\n   ";
				if (menuList[i][3]) { // 如果允许显示
					text += "#d#L" + menuList[i][2] + "#" + menuList[i][0] + menuList[i][1] + "#l";
					ccc++;
				}
			}
			text += "\r\n\r\n\t\t   #L999#" + leaf +"#fn华文行楷##fs22##e#r回上一頁#l"
			text += "\r\n\r\n  " +c+c+c+c+c+c;
			cm.sendSimple(text);
            break;
        case 1: //
			sele1 = selection;
			switch (selection){
				case 0://星力系統
					cm.dispose();
					cm.openNpc(2060009,"enhance");
					break;
				case 1://洗淺能
					cm.dispose();
					cm.openNpc(2060009,"Cuber");
					break;
				case 2://星石強化
					cm.dispose();
					cm.openNpc(2060009,"Nebulite");
					break;
				case 3://強化系統
					cm.dispose();
					cm.openNpc(1530635,2002);
					break;
				case 4://潛能傳承
					text = "#r潛能傳承僅能對副武器使用!!\r\n#b";
					text += "\r\n#L0#購買#v1092008##z1092008# - 10000 抵用券#l\r\n";
					text += "\r\n#r#L1#穿著的副武器潛能      -> 乾淨的鍋蓋上#l";
					text += "\r\n#L2#裝備欄第一個鍋蓋潛能  -> 穿著的副武器上#l\r\n";
					text += "\r\n#d#L3#開啟副武器商人#l";
					cm.sendSimple(text);
					break;
				case 999://回上一頁
					cm.dispose();
					cm.openNpc(9310111);
					break;
				default:
					cm.sendOk(menuList[selection][1] + " 正在籌備中!敬請期待。");
					cm.dispose();
					break;
			}
            break;
		case 2:
			if(sele1 == 4){
				switch (selection){
					case 0:
						if(cm.getPlayer().getCSPoints(2) < 10000){
							cm.sendOk("您沒有足夠的抵用券!");
							break;
						}
						if(!cm.canHold(1092008,1)){
							cm.sendOk("您的背包空間不足!");
							break;
						}
						cm.gainNX(2,-10000);
						cm.gainItem(1092008,1);
						cm.sendOk("購買完成!");
						break;
					case 1:
						if(cm.getPlayer().getCSPoints(2) < 100000){
							cm.sendOk("您沒有足夠的抵用券!");
							break;
						}
						if(!cm.canHold(1092008,1)){
							cm.sendOk("您的背包空間不足!");
							break;
						}
						cm.ex_weapon_poten(0);
						cm.sendOk("轉換完成!");
						break;
					case 2:
						if(cm.getPlayer().getCSPoints(2) < 100000){
							cm.sendOk("您沒有足夠的抵用券!");
							break;
						}
						if(cm.ex_weapon_poten(1))
							cm.sendOk("轉換完成!");
						else
							cm.sendOk("請將欲轉換之#r鍋蓋#k放置於#r裝備欄第一格#k!");
						break;
					case 3:
						cm.openShop(63);
						break;
				}
				cm.dispose();
			}else{
				cm.sendOk("發生錯誤，請聯繫管理員!");
				cm.dispose();
			}
			break;
        default:
			cm.sendOk("發生錯誤，請聯繫管理員!");
			cm.dispose();
			break;
    }
}
